import type { MenuProps } from "antd";

type MenuItem = Required<MenuProps>["items"][number];


function getItem(
  label: React.ReactNode,
  key: string,
  icon?: React.ReactNode,
  children?: MenuItem[],
  type?: "group",
): MenuItem {
  return {
    key,
    icon,
    children: children ? children : [],
    label,
    type
  };
}

// const handleMenuScreen = (data: IMenuListData[], jurisdictionArr: string[]): MenuItem[] => {
//   let returnArr: MenuItem[] = [];
//   data.forEach((element) => {
//     if (jurisdictionArr.includes(element.jurisdiction)) {
//       if (element.chidren) {
//         returnArr.push(
//           getItem(
//             element.title,
//             element.keyPath,
//             element.icon,
//             handleMenuScreen(element.chidren, jurisdictionArr)
//           )
//         );
//       } else {
//         returnArr.push(getItem(element.title, element.keyPath, element.icon));
//       }
//     }
//   });
//   return returnArr;
// };


export { getItem };
export type { MenuItem };
